package com.sanjin.dubbo.serialization.jdk;

import com.sanjin.dubbo.serialization.ObjectInput;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

/**
 * @author: jiangxch
 * @date: 2021/2/14 上午3:09
 */
public class JdkObjectInput implements ObjectInput {
    private ObjectInputStream ois;
    
    public JdkObjectInput(InputStream inputStream) throws IOException {
        ois = new ObjectInputStream(inputStream);
    }
    
    public <T> T readObject(Class<T> clazz) throws IOException, ClassNotFoundException {
        return (T) ois.readObject();
    }
}
